projects
/
babl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4701c2d
)
babl-palette: warn when trying to create a palette with > 256 colors
author
Ell
<ell_se@yahoo.com>
Thu, 14 Jun 2018 06:16:08 +0000
(
02:16
-0400)
committer
Ell
<ell_se@yahoo.com>
Thu, 14 Jun 2018 06:22:44 +0000
(
02:22
-0400)
... and only use the first 256 colors.
babl/babl-palette.c
patch
|
blob
|
history
diff --git
a/babl/babl-palette.c
b/babl/babl-palette.c
index 278c854fe48b48572bd4cb5a604cb156338bf38a..c70d4ed95affb6bea173667e3f7be4e1d0bded6d 100644
(file)
--- a/
babl/babl-palette.c
+++ b/
babl/babl-palette.c
@@
-872,6
+872,16
@@
babl_palette_set_palette (const Babl *babl,
{
BablPalette **palptr = babl_get_user_data (babl);
babl_palette_reset (babl);
+
+ if (count > 256)
+ {
+ babl_log ("attempt to create a palette with %d colors. "
+ "truncating to 256 colors.",
+ count);
+
+ count = 256;
+ }
+
if (count > 0)
{
*palptr = make_pal (format, data, count);